load("//tools:defaults.bzl", "ng_module", "ts_devserver")
load("//dev-infra/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")

package(default_visibility = ["//modules/benchmarks:__subpackages__"])

ng_module(
    name = "ng2_switch",
    srcs = glob(["*.ts"]),
    generate_ve_shims = True,
    tsconfig = "//modules/benchmarks:tsconfig-build.json",
    deps = [
        "//modules/benchmarks/src:util_lib",
        "//modules/benchmarks/src/tree:util_lib",
        "//packages/core",
        "//packages/platform-browser",
        "//packages/platform-browser-dynamic",
    ],
)

ts_devserver(
    name = "devserver",
    bootstrap = [
        "@npm//:node_modules/reflect-metadata/Reflect.js",
        "//packages/zone.js/bundles:zone.umd.js",
    ],
    entry_module = "angular/modules/benchmarks/src/tree/ng2_switch/index",
    port = 4200,
    scripts = [
        "@npm//:node_modules/tslib/tslib.js",
        "//tools/rxjs:rxjs_umd_modules",
    ],
    static_files = ["index.html"],
    deps = [":ng2_switch"],
)

benchmark_test(
    name = "perf",
    server = ":devserver",
    deps = ["//modules/benchmarks/src/tree:perf_tests_lib"],
)

e2e_test(
    name = "e2e",
    server = ":devserver",
    deps = ["//modules/benchmarks/src/tree:e2e_tests_lib"],
)
